//
//  ZH_MineIntegralViewController.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/24.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_MineIntegralViewController.h"
#import "ZH_PartnerRecodeTableViewCell.h"
@interface ZH_MineIntegralViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,weak)UITableView *tableView;
@property (nonatomic,weak)UIImageView *bgView;
@property (nonatomic,weak)UILabel *titleLabel;
@property (nonatomic,weak)UILabel *moneyLabel;
@property (nonatomic,weak)UIButton *button;
@end

@implementation ZH_MineIntegralViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initUserInterface];
}
- (void)initUserInterface{
    self.navigationItem.title = @"我的积分";
    self.view.backgroundColor = kCommonBackgroudColor;
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.view);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(FITSCALE(24));
        make.centerX.equalTo(self.view);
    }];
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(FITSCALE(11));
        make.centerX.equalTo(self.view);
    }];
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.moneyLabel.mas_bottom).offset(FITSCALE(15));
        make.centerX.equalTo(self.view);
        make.width.mas_equalTo(FITSCALE(91));
        make.height.mas_equalTo(FITSCALE(33));
    }];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bgView.mas_bottom);
        make.left.right.bottom.equalTo(self.view);
    }];
}
#pragma mark - UITableViewDelegate,UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return CGFLOAT_MIN;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return CGFLOAT_MIN;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ZH_PartnerRecodeTableViewCell *cell = [ZH_PartnerRecodeTableViewCell cellWithTableView:tableView];
    return cell;
}
#pragma mark - getter,setter
- (UITableView *)tableView{
    if(!_tableView){
        UITableView *tableView = [UITableView createTableViewWithDelegateTarget:self];
        tableView.backgroundColor = kCommonWhiteBg;
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        [tableView setCellAutoAdaptationForEstimatedRowHeight:FITHEIGHT(100)];
        [self.view addSubview:_tableView = tableView];
    }
    return _tableView;
}
- (UIImageView *)bgView{
    if (!_bgView) {
        UIImageView *image = [UIImageView createImageViewWithName:@"img_pay_bg"];
        [self.view addSubview:_bgView = image];
    }
    return _bgView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [UILabel createLabelWithText:@"当前学分" font:kFontSize_30];
        label.textColor = [UIColor colorWithHexString:@"#E6E6E6"];
        [self.view addSubview:_titleLabel = label];
    }
    return _titleLabel;
}
- (UILabel *)moneyLabel{
    if (!_moneyLabel) {
        UILabel *label = [UILabel createLabelWithText:@"100元" font:kFontSize_34];
        label.textColor = kFontColorWhite;
        [self.view addSubview:_moneyLabel = label];
    }
    return _moneyLabel;
}
- (UIButton *)button{
    if (!_button) {
        UIButton *button = [UIButton createNoBgButtonWithTitle:@"兑换" target:self action:nil];
        [button setTitleColor:[UIColor colorWithHexString:@"#00C9AE"] forState:UIControlStateNormal];
        button.backgroundColor = [UIColor colorWithHexString:@"#B9E2DD"];
        button.layer.cornerRadius = FITSCALE(16);
        button.layer.masksToBounds = YES;
        button.clipsToBounds = YES;
        button.titleLabel.font = kFontSize_34;
        [self.view addSubview:_button = button];
    }
    return _button;
}



@end
